package com.yunhe.task.client;

import com.yunhe.task.client.fallback.DeviceFallbackFactory;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.device.Analog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author liuronglei
 */
@FeignClient(value = "yh-device", fallbackFactory = DeviceFallbackFactory.class)
public interface DeviceClient {

    /**
     * 获得单位点表对应
     * @param stationId 电站ID
     * @param typeCode 类型代码
     */
    @RequestMapping(value = "/analogs/findCompanyPointNumber", method = RequestMethod.GET)
    ResponseEntity<ResultObject<Map<Long, List<Long>>>> findCompanyPointNumber(@RequestParam("stationId") Long stationId,
                                                                               @RequestParam("typeCode") String typeCode);

    /**
     * 获得电站点表对应
     * @param stationId 电站ID
     * @param typeCode 类型代码
     */
    @RequestMapping(value = "/analogs/findStationPointNumber", method = RequestMethod.GET)
    ResponseEntity<ResultObject<Map<Long, List<Long>>>> findStationPointNumber(@RequestParam("stationId") Long stationId,
                                                                               @RequestParam("typeCode") String typeCode);


    /**
     * 查找所有带公式的点号
     */
    @RequestMapping(value = "/analogs/hasFormula", method = RequestMethod.GET)
    ResponseEntity<ResultObject<List<Analog>>> findAnalogsByFormulaNotNull();
}
